//
//  OrderApi.m
//  SeaMelonSeeds_Counselor
//
//  Created by 尤振宇 on 2017/8/18.
//  Copyright © 2017年 杨笑. All rights reserved.
//

#import "OrderApi.h"

@implementation OrderApi
{
    NSString *_url;
    NSDictionary *_argument;
    YTKRequestMethod _method;
}

- (instancetype)initRequestDetailWithOrderID:(int)id
{
    self = [super init];
    if (self) {
        _url = @"consult/detail";
        _argument = @{@"consult_order_id":@(id),@"per_page":@"30",@"page":@(1)};
        _method = YTKRequestMethodPOST;
    }
    return self;
}

- (instancetype)initRequestSendApplyForWithOrderID:(int)id
{
    self = [super init];
    if (self) {
        _url = @"consult/sendCheck";
        _argument = @{@"consult_order_id":@(id)};
        _method = YTKRequestMethodPOST;
    }
    return self;
}

- (instancetype)initRequestServiceBeginWithServiceID:(int)id
{
    self = [super init];
    if (self) {
        _url = @"consult/begin";
        _argument = @{@"id":@(id)};
        _method = YTKRequestMethodPOST;
    }
    return self;
}

- (instancetype)initRequestServiceEndWithServiceID:(int)id
{
    self = [super init];
    if (self) {
        _url = @"consult/end";
        _argument = @{@"id":@(id)};
        _method = YTKRequestMethodPOST;
    }
    return self;
}

- (instancetype)initRequestSendGaugeWithServiceID:(int)id gauge_ids:(NSArray *)gauge_ids
{
    self = [super init];
    if (self) {
        _url = @"consult/sendGauge";
        _argument = @{@"consult_log_id":@(id),@"gauge_ids":gauge_ids};
        _method = YTKRequestMethodPOST;
    }
    return self;
}

- (instancetype)initRequestCreateDiagnosis:(int)id diagnosis:(NSString *)diagnosis
{
    self = [super init];
    if (self) {
        _url = @"consult/result";
        _argument = @{@"consult_log_id":@(id),@"result":diagnosis};
        _method = YTKRequestMethodPOST;
    }
    return self;
}

- (instancetype)initRequestGaugeList:(int)id
{
    self = [super init];
    if (self) {
        _url = [NSString stringWithFormat:@"consult/gaugeList/%d",id];
        _argument = @{@"consult_log_id":@(id)};
        _method = YTKRequestMethodGET;
    }
    return self;
}

-(instancetype)initRequestShow:(int)id
{
    self = [super init];
    if (self) {
        _url = [NSString stringWithFormat:@"consult/show/%d",id];
        _argument = @{@"consult_order_id":@(id)};
        _method = YTKRequestMethodGET;
    }
    return self;
}

- (instancetype)initRequestAccept:(int)id
{
    self = [super init];
    if (self) {
        _url = [NSString stringWithFormat:@"consult/accept/%d",id];
        _argument = @{@"consult_order_id":@(id)};
        _method = YTKRequestMethodPUT;
    }
    return self;
}

- (instancetype)initRequestRefuse:(int)id reason:(NSString *)reason
{
    self = [super init];
    if (self) {
        _url = @"consult/refuse";
        _argument = @{@"consult_order_id":@(id),@"body":reason};
        _method = YTKRequestMethodPOST;
    }
    return self;
}

- (instancetype)initRequestCall:(int)id
{
    self = [super init];
    if (self) {
        _url = [NSString stringWithFormat:@"consult/call/%d",id];
        _argument = @{@"consult_order_id":@(id)};
        _method = YTKRequestMethodGET;
    }
    return self;
}

-(NSString *)requestUrl
{
    return _url;
}

-(id)requestArgument
{
    return _argument;
}

-(YTKRequestMethod)requestMethod
{
    return _method;
}

@end
